Skip to content

Conversation

@odeimaiz
Copy link
Member

@odeimaiz odeimaiz commented Jun 3, 2025

What do these changes do?

In the same spirit as #7802, this PR avoids duplicated port compatibility calls by keeping a promises cache.

Before:
inputs_before

After:
inputs_after

Related issue/s

How to test

Dev-ops

@odeimaiz odeimaiz self-assigned this Jun 3, 2025
@odeimaiz odeimaiz changed the title 🐛🎨 Fix/dashes 🎨 Fix/enh: Avoid duplicated port compatibility calls Jun 3, 2025
@odeimaiz odeimaiz marked this pull request as ready for review June 3, 2025 14:45
@odeimaiz odeimaiz added t:enhancement Improvement or request on an existing feature a:frontend issue affecting the front-end (area group) labels Jun 3, 2025
@odeimaiz odeimaiz added this to the Bazinga! milestone Jun 3, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 3, 2025

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a promise-based cache for port compatibility requests to avoid duplicate network calls when checking port compatibility between services.

  • Switch calls to use the singleton instance method getCompatibleInputs
  • Add getCompatibleInputs member in Resources.js with in-memory and persisted caching
  • Remove the old static getCompatibleInputs and helper URL builder

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
services/static-webserver/client/source/class/osparc/utils/Ports.js Updated to call getInstance().getCompatibleInputs instead of the static method
services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js Updated to call getInstance().getCompatibleInputs instead of the static method
services/static-webserver/client/source/class/osparc/data/Resources.js Added new instance getCompatibleInputs with a promise cache and removed the old static implementation
Comments suppressed due to low confidence (2)

services/static-webserver/client/source/class/osparc/data/Resources.js:1433

  • [nitpick] The property name __portsCompatibilityPromisesCached is very long and uses double underscores. Consider renaming it to something clearer like _pendingPortsCompatibilityRequests to improve readability.
__portsCompatibilityPromisesCached: null,

services/static-webserver/client/source/class/osparc/data/Resources.js:1729

  • The new caching behavior isn't covered by existing tests. Add unit or integration tests to verify that (1) repeated calls with the same parameters return the cached result without making additional requests, and (2) different parameters still fetch new data.
getCompatibleInputs: function(node1, portId1, node2) {

@odeimaiz odeimaiz added the 🤖-automerge marks PR as ready to be merged for Mergify label Jun 3, 2025
@odeimaiz
Copy link
Member Author

odeimaiz commented Jun 3, 2025

@Mergifyio queue

@mergify
Copy link
Contributor

mergify bot commented Jun 3, 2025

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 3b558ec

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already looking forward to all this!

Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@mergify mergify bot merged commit 3b558ec into ITISFoundation:master Jun 3, 2025
109 of 111 checks passed
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Jun 6, 2025
92 tasks
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Aug 5, 2025
88 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖-automerge marks PR as ready to be merged for Mergify a:frontend issue affecting the front-end (area group) t:enhancement Improvement or request on an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants